package com.android.personal.kotlin.activity;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.android.personal.kotlin.R;
import com.android.personal.kotlin.adapter.ListButtonAdapter;
import com.android.personal.kotlin.model.ListButtonModel;

import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zhangwentao on 2017/1/5.
 */

public class ListButtonActivity extends BaseAppCompatActivity {

    private RecyclerView mRecyclerView;
    private ListButtonAdapter mListButtonAdapter;

    private List<ListButtonModel> listButtonModelList = new ArrayList<>();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.list_button_activity);
        initViews();
    }

    private void initViews() {
        getToolbarTitle().setText("列表按钮");
        getSubTitle().setText("不知道");

        mRecyclerView = (RecyclerView) findViewById(R.id.list_view);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        mRecyclerView.setAdapter(mListButtonAdapter = new ListButtonAdapter(this));
        createData();
        mListButtonAdapter.setData(listButtonModelList);
    }

    private void createData() {
        for (int i = 0; i < 10; i++) {
            ListButtonModel listButtonModel = new ListButtonModel();
            listButtonModel.name = "曲目" + i;
            listButtonModelList.add(listButtonModel);
        }
    }
}
